<template>
	<view class="page-product-detail">
		<view class="content">
			<view class="product-intro">
				<view class="swiper-wrapper">
					<swiper class="swiper" :indicator-dots="true" :autoplay="true" :duration="500" 
					indicator-color="rgba(192, 192, 192, .3)" indicator-active-color="#C0C0C0">
						<swiper-item v-for="(item, index) in images" :key="index">
							<view class="swiper-item">
								<image :src="item"></image>
							</view>
						</swiper-item>
					</swiper>
				</view>
				<view class="product-intro__title">
					<text>{{product.title}}</text>
				</view>
				
				<view class="product-intro__brief">
					<text>{{product.brief}}</text>
				</view>
				
				<view class="product-intro__price-sales">
					<view class="product-intro__price">
						<text class="price-num">{{product.price}}</text>
						<text>环保金</text>
					</view>
					<view class="product-intro__sales">
						<text>已售 {{product.sales}} 件</text>
					</view>
				</view>
				
				<view class="product-intro__quantity">
					<view class="product-intro__quantity-text">
						<text>购买数量:</text>
					</view>
					<view class="product-intro__quantity-num">
						<text class="subtract" @tap="subtract">㊀</text>
						<input type="number" @blur="getQuantity" v-model="quantity"/>
						<text class="add" @tap="add">㊉</text>
					</view>
				</view>
			</view>
		</view>
		
		<view class="content-line">
		</view>
		
		<view class="content">
			<view class="product-detail">
				<view class="product-detail__title">
					<text>商品详情</text>
				</view>
				<view class="product-detail__content">
					<view>
						<image src="../../static/product1.png"></image>
					</view>
				</view>
			</view>
		</view>
		
		<view class="buy">
			<view class="buy__button">
				<text>立即兑换</text>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				quantity: 1,
				images: ['../../static/product1.png', '../../static/product1.png'],
				product: {
					title: '定制分类垃圾桶',
					brief: '定制分类垃圾桶, 定制分类垃圾桶, 定制分类垃圾桶',
					price: '88.00',
					sales: '119'
				}
			}
		},
		onLoad(option) {
			console.log(option)
		},
		onShow() {
		},
		methods: {
			add() {
				this.quantity += 1;
			},
			subtract() {
				this.quantity = this.quantity > 1 ? this.quantity -= 1 : 1;
			},
			getQuantity() {
				console.log(this.quantity)
			}
		}
	}
</script>


<style>
	@import url("../../css/shop/productDetail.css");
</style>
